package com.wn.date20190814;

import java.util.HashMap;
import java.util.Map;

/**
 * 2，随机产生1000个1-10之间的整数，统计其出现的次数
 * 
 * @author song
 *
 */
public class RandomNumberCount
{

	public static void main(String[] args)
	{
		Map<Integer, Integer> numbers = new HashMap<Integer, Integer>();
		for (int i = 0; i < 1000; i++)
		{
			int num = (int) (Math.random() * 10 + 1);
			numbers.put(num, numbers.get(num) == null ? 1 : numbers.get(num) + 1);
		}
		System.out.println(numbers);
	}

}
